Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Frames Client #213

Merged
merged 8 commits into from
Apr 3, 2024
Merged

feat: Frames Client #213

merged 8 commits into from
Apr 3, 2024

Conversation

alexrisch
Copy link
Contributor

Added Frames package port from JS
Bumped protos library

Added Frames package port from JS
Bumped protos library
Alex Risch added 3 commits April 2, 2024 21:15
@alexrisch alexrisch marked this pull request as ready for review April 3, 2024 04:36
@alexrisch alexrisch requested a review from a team as a code owner April 3, 2024 04:36
Alex Risch added 2 commits April 3, 2024 10:31
Fixed lint on builds
Fixed lint on builds
val state: String?
)

data class GetMetadataResponse(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's going to make usability much better if this also included the frameInfo field which does a lot of the parsing of the extracted tags for you and assembles it into a nice object. Could happen in a follow-up PR.

Copy link
Contributor

@neekolas neekolas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great

Copy link
Contributor

@nplasterer nplasterer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really great. Mostly all nits to keep it inline with the rest of the kotlin sdk.

Really don't know how to review the ProxyClient. Kind of feels like something that might have been better suited for GRPC. But I might be missing it's use case.

}
is ConversationActionInputs.Dm -> {
val dmInputs = inputs.conversationInputs.inputs
val conversationTopic = dmInputs.conversationTopic ?: throw InvalidArgumentsError()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we throw an XMTPException instead. This helps integrators catch exceptions being thrown from our SDK easier.

Suggested change
val conversationTopic = dmInputs.conversationTopic ?: throw InvalidArgumentsError()
val conversationTopic = dmInputs.conversationTopic ?: throw XMTPException("No conversation topic")

Alex Risch added 2 commits April 3, 2024 14:27
Updated builder pattern usage
Updated timestamp logic
Removed FramesErrors and just used XmtpException
Updated builder pattern usage
Updated timestamp logic
Removed FramesErrors and just used XmtpException
Comment on lines +31 to +36
if (inputText != null) {
frame.inputText = inputText
}
if (state != null) {
frame.state = state
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason you null check here? Seems like state and inputText are okay with null being set?

Suggested change
if (inputText != null) {
frame.inputText = inputText
}
if (state != null) {
frame.state = state
}
frame.inputText = inputText
frame.state = state

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are not, it errors if the state is null or inputText is null, instead they use the default values

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh okay now I see you did this in iOS

let state = inputs.state ?? ""
Then to clean this up what about this

Comment on lines +31 to +36
if (inputText != null) {
frame.inputText = inputText
}
if (state != null) {
frame.state = state
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh okay now I see you did this in iOS

let state = inputs.state ?? ""
Then to clean this up what about this

val frameUrl = inputs.frameUrl
val buttonIndex = inputs.buttonIndex
val inputText = inputs.inputText
val state = inputs.state
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
val state = inputs.state
val state = inputs.state ?: ""

val opaqueConversationIdentifier = buildOpaqueIdentifier(inputs)
val frameUrl = inputs.frameUrl
val buttonIndex = inputs.buttonIndex
val inputText = inputs.inputText
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
val inputText = inputs.inputText
val inputText = inputs.inputText ?: ""

Just to match iOS and remove the null check inline

@alexrisch alexrisch merged commit 23b2673 into main Apr 3, 2024
5 of 6 checks passed
@alexrisch alexrisch deleted the ar/frames-client branch April 3, 2024 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants